/*
 * @Description: 原型链继承
 * @Author: zzj
 * @Date: 2021-09-07 11:58:09
 * @LastEditors: zzj
 * @LastEditTime: 2021-09-07 12:12:54
 */

function Animal(){
    Animal.prototype.name = "xiaobai";
    Animal.prototype.age = 2;
    Animal.prototype.sayName = function(){
        console.log(this.name);
    }
}
function Dog(){}
Dog.prototype = new Animal();  //完成了原型链继承的操作
Dog.prototype.constructor = Dog;  //重新指定一下构造函数
var d1 = new Dog();
console.log(d1);
console.log(d1.name);
d1.sayName();